<?php

class MY_Model extends CI_Model
{
	protected $is_new;

	public function __construct()
	{
		parent::__construct();
		$this->is_new = true;
	}

	public function getObject($aObject, $class_name = 'post')
	{
		$sType = get_class($this);
		$oObject = new stdClass($class_name);
		$oObject->is_new = false;
		foreach($aObject as $k=>$v) {
			if(is_array($v)) {
				$oObject->{$k} = $this->getObject($v);
			}else {
				$oObject->{$k} = $v;
			}
		}
		$sObject = serialize($oObject);
		$sObject = substr($sObject, 14);
		$sObject = 'O:'.strlen($sType).':"'.$sType.'"'.$sObject;
		return unserialize($sObject);
	}
}
